<meta title="宝贝推广订单" >
<div class="p">
    <div class="panel panel-success">
        <div class="panel-heading">
            <h4>宝贝推广订单</h4>
        </div>
        <div class="panel-body">
            <div class="p-b">
                <form class="form-inline m-b-wrapper-xs" id="form" s="form"
                      s-form="{action:function(){$page.node.val(1); $ordersGrid.refresh()}}">
                    <select class="form-control" s="select" s-build="S.get('/api/enum/valuesMap/core.enums.OrderPayType')"
                            name="payType">
                        <option value="">支付方式</option>
                    </select>
                    <select class="form-control" s="select" s-build="S.get('/api/enum/valuesMap/core.enums.SellerPromotionItemDepositOrderStatus?igNames=DELETED')"
                            name="status">
                        <option value="">选择状态</option>
                    </select>
                    <input autocomplete="off" type="hidden" name="page" id="page" value="1" />
                    <input autocomplete="off" type="submit" class="btn btn-primary" value="查找" />
                </form>
            </div>
            <table
                    id="ordersGrid"
                    s='datac,nda'
                    s-data="Smart.cleanJsonRef(S.get('/api/sellerPromotionItemDepositOrder/search', $form.node.serialize()))"
                    class="table table-stripped table-bordered">
                <tr>
                    <th>宝贝图片</th>
                    <th style="width: 250px;">宝贝标题</th>
                    <th class="text-center">原售价</th>
                    <th class="text-center">返现金额</th>
                    <th class="text-center">卖家</th>
                    <th class="text-center">数量</th>
                    <th class="text-center">支付金额</th>
                    <th class="text-center">支付方式</th>
                    <th class="text-center">支付宝交易号</th>
                    <th class="text-center">状态</th>
                    <th class="text-right">操作</th>
                </tr>
                <tbody s="loop" s-data-filter="'results'">
                <tr s-loop-role="empty">
                    <td colspan="11" class="alert alert-warning">
                        暂无订单，请先进行添加
                    </td>
                </tr>
                <tr s-loop-role="row" s="row,datac">
                    <td s="tpl">
                        <img src="{%=this.sellerPromotionItemPicUrl%}" style="max-width: 50px; max-height: 50px;" />
                    </td>
                    <td s="tpl">
                        <a target="_blank" href="{%=this.sellerPromotionItemUrl%}" external><span class="text-warning">【{%=this.sellerPromotionItemEcomPlat%}】</span>{%=this.sellerPromotionItemTitle%}</a>
                    </td>
                    <td class="text-center" name="sellerPromotionItemOriginPrice"></td>
                    <td class="text-center" name="rebateFee"></td>
                    <td class="text-center" name="sellerPromotionItemShopTitle"></td>
                    <td class="text-center" name="num"></td>
                    <td class="text-center" name="paidFee"></td>
                    <td class="text-center" name="payTypeTitle"></td>
                    <td class="text-center" name="alipayTransferTradeNo"></td>
                    <td class="text-center" s="tpl">
                        <a href="javascript:;" class="label
                            {%
                                switch(this.status) {
                                    case 'WAIT_PAY':
                                    case 'TRANSFER_WAIT_VERIFY':
                                        out.print('label-warning'); break;
                                    case 'VERIFY_FAIL': out.print('label-danger'); break;
                                    case 'PAID': out.print('label-success'); break;
                                    default: out.print('label-default');break;
                                }
                            %}
                        " s-click="showVerifyRemark(this)">{%=this.statusTitle%} <i class="fa fa-question"></i></a>
                    </td>
                    <td s="tpl" class="text-right">
                        {%if(this.status == 'TRANSFER_WAIT_VERIFY') {%}
                        <a href="javascript:;" class="btn btn-outline btn-xs btn-info" s-click="verify(this)">审核</a>
                        {%}%}
                    </td>
                </tr>
                </tbody>
                <tfoot>
                <tr>
                    <td colspan="11" class="text-right">
                        <ul s="pagination" id="sellerPagination" s-pagination="{action:function(){$page.node.val(this); $ordersGrid.refresh()}}"
                            class="pagination pagination-sm" >
                        </ul>
                        共有<span name="total"></span>个宝贝
                    </td>
                </tr>
                </tfoot>
            </table>
        </div>
    </div>
</div>
<script type="text/javascript">
    function verify($s) {
        S.popupOpen("/sellerPromotionItemDepositOrder/sellerPromotionItemDepositOrder-verify.html", {order: $s.parent().data()}).done(function(rs) {
            rs && $ordersGrid.refresh()
        })
    }

    function showVerifyRemark($s) {
        S.alert($s.parent().data().verifyRemark)
    }

</script>